import Vue from 'vue';
import App from './App.vue';
// import 'amfe-flexible';



//引入路由器模块
import router from "./router/index"

//引入VueRouter
import VueRouter from "vue-router"

//处理时间格式的包
import moment from "moment"

//引入vuex
import store from "@/vuex/store"

//css样式
import "@/assets/style/resets.css"
import "@/assets/style/global.css";
import 'element-ui/lib/theme-chalk/index.css';   //element-ui  的css样式
// import ElementUI from "element-ui";
//按需引入element-ui
import {Container,Header,Aside,Main,Form,FormItem,Input,Button,Row,Col,Radio,DatePicker,Message,Table,TableColumn,Image,Pagination} from "element-ui"
//引入公共面包屑组件
import BreadCrumb from "@/components/commons/BreadCrumb.vue";

//引入echarts
import echarts from "echarts";
//将echarts放到vue的原型对象上
Vue.prototype.$echarts = echarts;

// 将其放到Vue的原型对象上
Vue.prototype.$message = Message;

// 将时间格式处理函数放到原型对象上供所有的组件使用
Vue.prototype.$moment = moment;

// VueRouter  3版本之后的都是 升级后变为了promise对象，重复点击路由报错 push replace
// 统一处理catch
const originPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location,onResolve,onReject){
  if(onResolve || onReject) return originPush.call(this,location,onResolve,onReject)
  return originPush.call(this,location).catch(err=>err);
}

const originReplace = VueRouter.prototype.replace;
VueRouter.prototype.replace = function replace(location,onResolve,onReject){
  if(onResolve || onReject) return originReplace.call(this,location,onResolve,onReject)
  return originReplace.call(this,location).catch(err=>err);
}


// 将vuex的store对象放到Vue  
Vue.store = store;

Vue.config.productionTip = false

Vue.use(Container);
Vue.use(Header);
Vue.use(Aside);
Vue.use(Main)
Vue.use(Form);
Vue.use(FormItem);
Vue.use(Input);
Vue.use(Button);
Vue.use(Row);
Vue.use(Col);
Vue.use(Radio);
Vue.use(DatePicker);
Vue.use(Table);
Vue.use(TableColumn);
Vue.use(Image);
Vue.use(Pagination);


//注册全局面包屑导航
Vue.component("BreadCrumb",BreadCrumb)



new Vue({
  store,
  router,
  render: h => h(App),
}).$mount('#app')
